Skip to content

feat(hosts): 接入 Qoder,整合 Cursor/openCode,打通原生 Windows 门禁 - #29

Merged
ayochao merged 39 commits into
mainfrom
feature_support_Cursor_openCode_Qorder
Nov 27, 2026
Merged

ayochao merged 39 commits into
mainfrom
feature_support_Cursor_openCode_Qorder

Conversation

@zhangdelong-didi

@zhangdelong-didi zhangdelong-didi commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Problem and resulting behavior / 问题与改动效果

关联:#18 #19 #20(原生 Windows 运行时缺陷)已由合并的 #26(2026-11-14)关闭,#21 未合并即关闭;本分支处理的是 #26 之后在六平台 CI 上继续暴露出来的 Windows 问题,正文不含 Closes 关键字,覆盖结论记录在 docs/platform-support.md。

与既有 PR 的关系:#14(OPEN,anderszhang)修改同一批 helixharness/hosts/qoder/* 文件但采用不同的入口投影,本分支不含其提交(范围内无该作者提交);#1(OPEN,OpenCode V2)情况相同。两条 Qoder 表面不宜并行落地,需先定合并顺序。

本分支把三个宿主接入整合到 GitHub main 5bde4b3 之上,并让原生 Windows 从「未验证」变成 CI 门禁实际覆盖的平台。34 个提交、264 个文件(155 新增),四条线在同一分支内相互依赖,因此作为整包提交,按下面的阅读路径分段 review。

Qoder(新增宿主)

  • hosts/qoder/ Host Kit + .qoder-plugin/plugin.json + scripts/package_qoder_plugin.py 共 25 个新文件。Qoder 只能通过 App 安装工具消费插件 ZIP,没有等价 marketplace CLI,因此提供打包脚本而不是市场条目:ZIP 根即插件根,只收 Qoder 会加载的表面(正面白名单:清单、hooks/hooks.json、agents/、commands/、scripts/、reference/、skills/、templates/、workflows/、hosts/qoder/、hosts/shared/、宿主编排 schema 与说明文件),其它宿主表面与本地文件进不去;在 git 仓库内构建时,白名单路径下未纳入版本控制的文件与解析到插件根之外的符号链接都会直接报错。agents/*.md 注入与文件名一致的 name frontmatter。
  • 9 个公共入口以 helix:<command> 形态的 Skill 薄入口投影(hosts/qoder/skills/)。实测插件的 commands/ 没有进入任何注册面、程序发送 /helix:status 零展开透传,所以 command_surface 记为 emulated 而不冒充 native。
  • 新增声明式陈旧 hook 绑定策略:hosts/qoder/project-hooks.json 声明 stale_binding_policy = {recognize: linter_flag, merge: collapse, check: warn}。重跑 /helix:init 时 project_hooks_cli.py merge 只认领「<python> -X utf8 <script> --repo-root <dir> --linter <已知名称> 且没有其他参数」的自生成 handler,同一 linter 的重复项折叠为一条并改写为当前版本目录(macOS 上 /tmp 与 /private/tmp 一并收敛);带额外参数的团队 handler 原样保留并返回 Preserved user-modified linter handler 告警,同时补齐规范 handler,不会静默丢参数;check 把残留差异降级为 warning,新增 --strict 才阻断。用户自己的其它 Hook 不受影响。
  • plugin_update = unsupported:/helix:update 返回阻断并给出手动步骤。telemetry = unsupported:只注册 SessionStart,不读写 consent 与 eval-log、不发起异步上报。

Cursor 与 openCode
整合 Cursor 原生支持(f213db5、3a3b5af)与 openCode 宿主(17826a8、ed08751),按实测收紧能力声明;docs/cursor-testing.md、docs/opencode-testing.md 记录各自验收与边界。宿主清单 API 接受范围由 1.1 扩展到 1.2(当前仅 Cursor 声明 1.2,既有 1.1 清单不受影响)。

原生 Windows(行为变化)

  • scripts/cli_stdio.py 为全部 JSON 命令行入口保证 UTF-8 stdio,并按 surrogateescape 回传 POSIX C locale 下无法解码的 argv 字节,避免 UnicodeEncodeError: surrogates not allowed(该回归曾在 Ubuntu 3.10/3.12 复现)。
  • 目录落盘、原生安装锁、解释器探测与 hook 命令跨平台化;Claude 在 Windows 上遵循宿主声明的 Bash shell(fbb7508)。
  • 测试夹具改为按真实形态断言:hook 命令按 argv 与只读位校验;宿主 CLI 存根补 PATHEXT 可见的 .cmd 包装;净化 env 时补 SystemRoot/COMSPEC/PATHEXT 与沙箱 home;POSIX shell 专属夹具显式跳过,而不是伪装通过。

评审阻断项修复(本轮)

  • 打包不再扫本地文件:scripts/package_qoder_plugin.py 由 rglob + 排除表改为正面白名单 is_packaged();白名单路径下的未跟踪文件与越过插件根的符号链接在收集阶段直接拒绝,verify_archive 逐条复核。实测构建 345 项全部属于 Qoder 表面,hosts/cursor/、hosts/opencode/、opencode/、package.json、tsconfig.json、AGENTS.md、CLAUDE.md 均不在包内;新增 4 个回归测试(白名单、逃逸符号链接、未跟踪文件、无 git 时的白名单回退)。
  • 重跑 Init 不再覆盖团队 Hook:_recognize_linter_name 改为逐 token 严格解析;带 --team-profile strict 一类自定义参数的 handler 原样保留、返回 Preserved user-modified linter handler 告警,并补齐规范 handler;旧的版本目录折叠行为保持不变。
  • OpenCode 阶段遥测恢复可入库:telemetry_collector 的 evidence 补上 helixharness-evolution-evidence/1.0 schema,平台 _snapshot_payload 保留 status / reason_code,快照不再把「会话未采集」退化成空证据,也不会再因 invalid_evidence 被拒收。

Reviewer guide / 分段阅读路径

顺序 范围 入口文件
1 共享运行时与 JSON CLI 编码 scripts/cli_stdio.py、scripts/atomic_files.py、scripts/python_runtime.sh、scripts/runtime_preflight.sh
2 宿主清单合同 hosts/host-manifest-v1.schema.json、scripts/host_runtime/__init__.py
3 Qoder 宿主面 hosts/qoder/host.json、hosts/qoder/project-hooks.json、scripts/project_hooks_cli.py、scripts/package_qoder_plugin.py
4 Cursor / openCode hosts/cursor/、hosts/opencode/、scripts/cursor_native_install.py、scripts/task_plan.py
5 平台侧观测 helixharness-platform/eval/*、web_ui/tests/test_cursor_native_usage_pipeline.py
6 文档 docs/installation.md、docs/platform-support.md、docs/user-guide*.md、docs/cursor-testing.md、hosts/qoder/installer.md

Verification / 验证

  • 本地 macOS / Python 3.12 全量插件套件(本轮修复提交):Ran 954 tests in 333.771s — OK (skipped=12),单次无并发干扰运行;平台 eval/tests 216 passed,ruff check web_ui eval bench evolution tests 全通过。
  • CI run 45559700342 六平台全绿:macOS 3.10/3.12、Ubuntu 3.10/3.12、Windows 3.10/3.12。跨包验收套件(helixharness-platform/web_ui/tests/test_cursor_native_usage_pipeline.py)首次在 Windows 跑通。
  • Windows 失败收敛轨迹:197 failed / 57 errors → 35F/6E → 11F/6E → 7 → 0。
  • python3 scripts/codex_skill_projection.py --check PASS;python3 scripts/host_runtime_cli.py list 返回 claude-code / codex / cursor / opencode / qoder 且 status: ok。
  • 稳定性改造经过变异测试:把 anchor→lock 用例的递归 deadline 换成重新计算的 deadline,断言以 1 != 2 失败;去掉 deadline,用例在 2.007s 超时失败。改写后的用例仍在检测原属性。
  • 凭据与隐私审计:对 5bde4b3...HEAD 全部新增行扫描,无 github_pat_*/ghp_*/AKIA*/PEM 头命中;两处明文赋值均为合成夹具;无真实家目录、内部域名或运行产物;测试邮箱统一使用保留域 .invalid/.test;文档中的宿主配置目录写为 QODER_CONFIG_DIR 占位符。

未验证的行为(请勿据此认为已通过)

  • Qoder Desktop 的 macOS 实机验收证据覆盖 1.1.0–1.2.8 安装记录的装载四项与陈旧绑定收敛,1.3.0 的本轮复验仍在进行;docs/platform-support.md 的 macOS 表述对应这些已记录会话。
  • Qoder App 与 Cursor 在 Windows 上均无实机会话,Windows 侧只有 Host Kit 契约测试与套件覆盖。hosts/cursor/host.json 新增一条 limitation,并在 docs/cursor-testing.md 说明为何不按猜测把身份前缀改成 PowerShell 语法。
  • 宿主自动触发 Hook 的端到端链路、真实模型评测、外部上报服务投递不在本 PR 证据范围内(与 docs/cursor-testing.md 的声明一致)。
  • CI 的 Ruff 只作用于 helixharness-platform,插件 scripts/ 无 lint 门禁;文档链接为本地校验,仓库内暂无自动化检查。
  • 上一轮提交 09b7950(本轮修复前)的六平台矩阵已全部通过:run 45630926767 / 45627694452 / 45627448059(pull_request)与 45627438646(push)均为 completed/success。原生 Windows 作业运行的是完整套件:插件侧 Ran 949 tests → OK (skipped=124)(3.10 用时 641.832s,3.12 用时 730.131s),平台侧 834 passed, 8 skipped;同一提交在 ubuntu/macos 上为 OK (skipped=12) 与 840 passed, 2 skipped。本轮修复提交 92c492c:push run 45750056854 六作业全部成功,插件侧 Ran 954 tests,逐作业明细见 PR 评论。
  • 上述差额是本 PR 的真实边界,不是通过率的注脚:Windows 比 POSIX 多跳过 112 项,集中在 POSIX shell 依赖、真实目录权限与可选工具链(uv / node / javac)三类运行时跳过上(仓库内静态 POSIX 专属声明仅 17 处,其余由 skipTest 在运行时决定,CI 日志未逐项标注归属)。因此本轮结论是「套件在原生 Windows runner 上不再崩」,不等于「Windows 与 POSIX 等价」,也不改变 Qoder App 与 Cursor 在 Windows 上仍无实机会话这一声明。

Compatibility and documentation / 兼容性与文档

  • 运行时要求不变:Python 3.10+、Git、支持插件的宿主;Windows 不需要 WSL。新增说明:Cursor 的 POSIX hook 启动器依赖 sh,而原生 Windows 安装并不保证这一点(CI 是靠 .github/workflows/cross-platform.yml 把 Git for Windows 的 bin 加进 PATH 才通过的)。

  • 配置面变化:Qoder 写入项目 .qoder/settings.json;.qoder-plugin/plugin.json 的 version 决定 <QODER_CONFIG_DIR>/plugins/cache/local/helix/<version>/ 落盘位置,与其它宿主清单版本独立递增。

  • 工作流变化:Qoder 上升级只能重新打包安装新版 ZIP,/helix:update 返回阻断;重跑 /helix:init 会自动收敛陈旧 handler,其它宿主仍按完整参数相等识别,换版本目录后仍需手动删除指向已卸载目录的条目。

  • 受影响指南(中英同步):docs/installation.md、docs/platform-support.md、docs/user-guide.md 与 docs/user-guide.zh-CN.md、docs/cursor-testing.md、README.md 与 README.zh-CN.md、helixharness/hosts/qoder/installer.md。新增 docs/claude-testing.md、docs/codex-testing.md、docs/opencode-testing.md。

  • This change is focused and contains no credentials, private conversations or runtime data.

  • Relevant tests and documentation have been updated.

  • Third-party notices are preserved.(LICENSE、NOTICE、THIRD_PARTY_NOTICES.md 在 diff 中未被修改)

acderchenjunwei and others added 30 commits November 20, 2026 16:24
Add Cursor marketplace manifests, slash-command skills, native and managed
installers, identity hooks, scoped cleanup, consent-based telemetry and updates.
Harden Init completion and command guidance, shared usage accounting and D2C
whitespace checks while preserving Claude Code and Codex compatibility.
Document supported capabilities, installation paths and accepted limitations.

Remove unused code and imports, normalize Cursor installation transaction paths,
and reject non-commit Git objects during native source verification.

Validation: 727 plugin cases covered (one sandbox-blocked case passed an isolated
retry); 132 related platform cases passed; D2C 13 groups passed and 2 skipped for
missing optional dependencies. Skill projections, Ruff and document links passed.
Retain the documented pre-existing original-host update and cache-usage findings.
Merge the Cursor host work from f213db5 into the GitHub baseline 5bde4b3.
Resolve 17 conflicting files while preserving cross-platform Python 3.10+
runtime selection, greenfield Init, and existing Claude Code/Codex behavior.

Combine deferred Init completion with greenfield state handling, preserve
Windows consent-lock bounds alongside Cursor hook deadlines, keep runtime
resources and telemetry snapshots, and bind Cursor launchers to the selected
Python interpreter. Refresh bilingual installation and verification guidance.

Validation: plugin suite 780 cases (773 passed including one environment retry,
7 Windows-only skips); platform suite 842 cases (840 passed including six
environment retries, 2 Windows-only skips); all 15 D2C groups passed.
Skill projections, host registry, Ruff, document links, and independent
Standards/Spec reviews passed. No fresh native-host acceptance is claimed.
Port OpenCode native V2 registration and fail-closed session binding onto the GitHub Cursor branch. Preserve Cursor runtime snapshot behavior and include only public OpenCode runtime files in managed bundles.

Co-authored-by: masongyan <masongyan@delonixmail.com>
Select the command shell in the Claude Host Kit, normalize Bash path arguments, and handle CRLF Python version output. Preserve Codex PowerShell behavior and add shell, preflight, and native Windows regression coverage.
Bind command and skill context to the requesting session, enforce package
resource boundaries, and add project checks and receipt-based task updates.
Protect UT artifacts with atomic publication and evidence-based findings.

Support consent-bound stage telemetry and guarded Git updates, preserve
canonical host contracts, and share explicit D2C evidence validation. Include
both OpenCode runtime modules in Cursor managed installs and upgrades.

Validate the integrated tree with 4 managed-bundle checks, 146 OpenCode tests
and 515 assertions, and TypeScript type checking. The identical candidate
also passed 913 Python tests with 10 platform skips and targeted OpenCode
2.3.2 real-model verification of checks, telemetry, UT writes, and Status.
Qoder 不解析其它宿主的插件清单,也没有把插件 commands/ 注册为可调用斜杠命令的
表面,因此公共入口投影为 hosts/qoder/skills/ 薄入口,唯一业务契约仍只在
commands/*.md 保存一份。分发表面没有等价 marketplace CLI,改为
scripts/package_qoder_plugin.py 产出只含 Qoder 表面的 ZIP,由 App 安装工具落盘。

host.json 的能力面与限制按 Qoder 实测填写,不借用其它宿主的行为推断:会话沿用
启动时绑定的 plugin_root、更新不刷新绑定;项目级 hooks 会话中途写入即生效;hook
非零退出只留静默记录,不进模型上下文;disable-model-invocation 的方法 Skill 不计入
可见列表。plugin_update 与 telemetry 如实记为 unsupported。

telemetry_async.py 去掉 .claude-plugin/.codex-plugin 硬编码,改为读取各 Host Kit 自己
声明的 distribution 资源,新增宿主无需再改该文件;安装与版本判定共用同一解析入口。
Qoder 按 <name>/<version> 目录落盘、且 repo-root 会被解析成符号链接真实路径,旧版
project_hooks_cli 用 argv[1:] 全等识别自生成命令,导致插件升级后重新 init 认不出上一版
本的 handler,重复追加并静默失败。现把识别与收敛策略作为 Host Kit 声明数据:Qoder 声明
linter_flag + collapse + warn,共用代码只消费声明、不按宿主 ID 分支。

- project_hooks 契约新增可选 stale_binding_policy 字段,默认 exact_args/append/fail
  保持 codex/claude-code 现有行为不变
- merge 按 --linter 加脚本路径尾部的形状识别自生成命令,同形状重复项仅保留首条;
  check 默认把缺失/重复降级为 warnings,--strict 恢复为失败
- 新增 3 个测试:版本目录收敛、warn 与 --strict 双态、非形状匹配命令不被认领
- Qoder 分发版本 1.2.9 → 1.3.0
…ursor_openCode_Qorder

Bring the Qoder Host Kit and the declarative stale-binding policy onto the
Cursor/openCode feature branch. Qoder's project-hooks.json opts into
shape-based linter recognition (`--linter` + script tail + absolute
interpreter), automatic collapse of duplicates, and warn-by-default check
with --strict to promote drift to failure; other hosts keep the exact_args
behaviour. telementry_async now discovers each host's distribution
manifest through the Host Kit instead of hard-coding platform directories,
and package_qoder_plugin.py produces the App-installable ZIP.

Conflict resolutions preserved both sides: flat hook merge path from the
feature branch, stale-binding policy from the Qoder branch, dynamic
RUNTIME_RESOURCE_DIRECTORIES, and the union of the supported host set
(claude-code / codex / cursor / opencode / qoder). Post-merge fixture
adjustments cover PUBLIC_ROOTS, telemetry snapshot host set, synthetic
codex distribution adapter, and .qoder-plugin in the Cursor bundle
distribution dirs.
Qoder 适配已经落到特性分支,但根 README 与 docs/installation.md 的宿主
清单一直停留在 Codex / Claude Code / Cursor / OpenCode 四项,新用户 clone
后从 GitHub 首页看不到 Qoder 支持,只有点进 helixharness/ 二级目录才能发
现 hosts/qoder/installer.md。

- 中英 README:宿主清单、Requirements、Quick start 段落、示例分组与 Roadmap
  均加入 Qoder;新增一段 Qoder 本地 ZIP 安装说明,并链接 hosts/qoder/installer.md。
- docs/installation.md:Requirements、Install from GitHub 提示加入 Qoder;
  在 Cursor 与 Updates 之间插入 `## Qoder` 小节(带 `#qoder` 锚点),
  覆盖打包脚本、App / 会话内两种安装入口、hooks 审阅、版本目录与
  cache 语义、unsupported 的 plugin_update 及 Host Kit 陈旧绑定收敛行为;
  Updates、Uninstall 与中文说明同步补齐 Qoder 分支,保持中英对齐。
Windows 上 project_hooks_cli 通过 windows_command(argv) 生成
powershell.exe -NoProfile -NonInteractive -EncodedCommand <base64>,
直接把 "--linter invariant-check" 作为子串断言会在 CI 上永远失败。
改用 _parse_windows_command/_parse_posix_command 先还原 argv,
再按 --linter 位置读取名称,让 collapse 断言跨平台成立。
observe() 通过比较 before/after 的 rglob 快照判断 status 是否只读;macOS runner
后台偶尔会写 .git/objects/maintenance.lock 又清掉,让同一份 fixture 前后集合不一致。
在 setUp 的 GIT_CONFIG 里加上 gc.auto=0 与 maintenance.auto=0,让本测试创建的
仓库在窗口期内不再触发 git 自维护。
Expose Git Bash 只加了 Git\bin(含 bash.exe / git.exe),但 sh.exe 实际落在
Git\usr\bin\。Cursor / Claude 的 command_scenarios 与 entry_repairs 里 36 条
subprocess.run(["sh", "-c", ...]) 因此一直报 WinError 2 文件未找到。补一行
把 usr\bin 追加进 GITHUB_PATH 即可。
宿主场景 fixture 故意清空宿主环境来证明用例不依赖开发者机器上的工具,但
Windows 上这样会连带打死两样东西:子 python.exe 缺 SystemRoot 时停在
_Py_HashRandomization_Init,os.defpath 里没有 Git 安装目录导致 fixture 自己要
跑的 git 与 sh 解析不到。统一走 env_sandbox,Windows 才补、POSIX 结果不变。
Windows 上自生成的 hook 命令是 powershell -EncodedCommand,直接对命令字符串
assertIn 会挂;assertNotIn 更糟——旧 python 路径被 base64 藏起来,用例会假通过。
统一走 hook_argv() 解析回 argv 再断言。权限位同理:Windows 只建模 read-only,
0600/0640 无法还原,按仓库里 feedback_submit 已有的写法收窄。
os.open(dir, O_RDONLY) + fsync 是 POSIX 才有的把 rename/unlink 落盘的办法,
Windows 打不开目录句柄,直接 PermissionError。抽 atomic_files.fsync_directory()
统一承接四处(其中两处原本各自内联 os.name 判断)。ProjectInstall.locked() 只有
fcntl 分支,按 metrics.py 已有的写法补 msvcrt:msvcrt 锁的是字节区间且不允许越过
EOF,所以先把锁文件垫一个字节再 NBLCK/UNLCK。
三处 env 只留 PATH,Windows 上子 python 起不来。run_gate 断言 stderr 为空时
unittest 把 diff 折成一行提示,看不到 node 到底说了什么,改成把有界的 stderr
放进断言消息。
check_text 比较时把 CRLF 归一成 LF,merge_text 却照拼 LF 块,于是 AGENTS.md 用
CRLF 保存时 check 说 pass、merge 说 changed,每次 Init 都把用户的整段换行改写一遍。
改为按被替换区段(或整文件,纯追加时)的换行形态渲染,并补三种形态的用例。
61593c8 已合入 stale_binding_policy,但文档仍停在旧语义:init.md 把 check
失败一律写成 BLOCKED,installer.md 还要求更新插件后手动删除指向旧版本目录的
handler。两条现在都不成立,且打包脚本按工作树读取,导致验收装到的说明与
PR 里的不是同一份。
Windows 的 expanduser 只读 USERPROFILE/HOMEPATH/HOMEDRIVE,不回落 HOME
(本机读 ntpath.expanduser 的常量表可证),于是只设 HOME 的夹具在 Windows 上
让 Path.home() 抛 Could not determine home directory.,run 27 里这类错误 24 次,
集中在 update scenarios 与 cursor hook fastpath;反过来完全不给 home 时,POSIX
会经 passwd 库解析到开发者真实家目录,隔离是假的。env_sandbox 增加 home_vars
同时下发两个键,6 处夹具改用它。
d2c gate 与 bundle 探针把 env 净化成只剩 PATH,Windows 上 node.exe 因此定位不到系统
加密 DLL,在 InitializeOncePerProcessInternal 断言 ncrypto::CSPRNG(nullptr, 0) 后以
134 中止。run 27 的 stderr 原文证实这与断言写法无关,是启动期缺环境变量,和 Python
的 _Py_HashRandomization_Init 同处理:复用 env_sandbox.boot_vars()。
update host 通过 shutil.which(argv[0]) 解析裸命令名(update_hosts/base.py:71),
Windows 的 CreateProcess 只补 .exe,于是只有 shebang 的 bin/codex 起不来:check
没写过 state/cache.json,prepare 读它时经 version_update.py:163 合并成的同一句
"invalid JSON file" 报出,run 28 里这种伪装成 JSON 问题的失败 22 个。env_sandbox
增加 cli_stub,POSIX 仍是 shebang 加执行位,Windows 另写 .cmd 包装,形态沿用
test_claude_event_stream.py 里已有的写法。
这组夹具把 sh 和 dirname 符号链接进一个空的 bin 来隔离 PATH,Windows 上无法
等价:MSYS 只从自身目录启动,而那个目录同时带着真 git 和 python3,正是这些
用例要按意图移除的东西,硬跑会把干净的失败换成语义错误的失败。按
test_runtime_preflight.py:20 的既有先例处理,但只跳过真正执行 shell 命令的
用例,test_native_windows_binding_gates_before_using_the_selected_launcher
与用 ambient PATH 的 argv 保真用例在 Windows 上照跑。同时改掉那句声称
"原生 Git Bash 行为在 Windows CI 另有覆盖"的注释——它本来不成立。
version_update.py 与 user_config.py 把 ensure_ascii=False 的结果直接写到
stdout。Windows 默认代码页 cp1252 编不出安装路径里的非 ASCII 字符,print
就抛 UnicodeEncodeError,宿主收到的是一段 traceback 而不是它要解析的 JSON。
Windows 3.12 剩余 41 个失败里 26 个是这一个原因(claude 10、codex 10、
codex lifecycle 6,逐帧核对到 version_update.py:1545 和 user_config.py:210)。

这不是夹具该迁就的环境差异:仓库已经把这条契约写成测试
(test_metrics.py 的 consent CLI 在 -X utf8=0 加 Unicode 路径下仍须退出 0),
telemetry_consent.py 里也早有对应的 stdio 护栏。所以把护栏提成共享的
scripts/cli_stdio.py,三个入口在 main() 首行调用,不再各自假设调用方一定
经过带 -X utf8 的 {helix_python} 启动器。

新增 test_cli_stdio.py 把契约钉在跨平台可跑的位置:强制 C locale 且关掉
PEP 538 补偿,先用探针确认本机 stdio 真的落到了遗留编码(否则 skip,不让
测试空过),再对子进程 stdout 做严格 UTF-8 解码并断言中文路径原样回环。

本地验证:改前两命令均 UnicodeEncodeError 退出 1,改后输出合法 UTF-8 JSON
退出 0;全量 945 tests OK (skipped=12),新模块 2 tests OK。
- 文档里的检测脚本用裸 `bash` 执行:CI 的 PATH 里 System32 在前,命中的是
  WSL 启动器,没有发行版就返回 1 并吐出 UTF-16 文本。改用仓库已有的
  git_bash(),它的注释写明“never the Windows/WSL launcher”,其他夹具也这么用。
- 净化 PATH 后只有 System32,而合并出来的 Windows hook 命令以
  powershell.exe 开头(project_hooks_cli.py 的 WINDOWS_COMMAND_PREFIX),
  实际二进制在 System32\WindowsPowerShell\v1.0。search_path() 补上该目录。
- 两处断言把内嵌 JSON 里的路径当纯文本子串比:Windows 反斜杠在 JSON 里
  是双写的,shlex.quote 又把整段值引起来。改比 json.dumps(...)[1:-1],
  POSIX 下取值不变,因此不影响 macOS/Linux 的判定。
- sessionStart 的门形态断言写死了 POSIX 的 `require &&`;Windows 侧发的是
  .ps1 检查形态,按 os.name 选择断言目标,保留“仍然带 preflight 门”的意图。

本地 52 tests OK:这几处改动在 POSIX 上与改前等价,只修 Windows。
上一个入口级修复后 Windows 3.12 仍剩 17 个,说明逐条修不是收敛路径:`scripts/` 与
`hosts/` 里 `main()` 用 `ensure_ascii=False` 打印 JSON 的入口有 25 个,此前只有 3 个调
`configure_utf8_stdio()`。这轮 `metrics.py:721` 是下一个,它的异常又被自身的 `except`
包成 `invalid lite metrics: 'charmap' …`,所以看着像一类新问题。

- 22 个入口补守卫,含 `hosts/claude-code` 与 `hosts/cursor` 两个 hook 入口。
- `test_cli_stdio.py` 增加 AST 覆盖规则:入口内出现非 ASCII JSON 打印就必须先调守卫,
  且位置在第一条这样的打印之前。规则当场抓出 `hosts/cursor/hook_entry.py` 这个按行
  匹配漏掉的入口,也避免以后新增入口再漏。
- `RUNTIME_FILES` 补 `cli_stdio.py`:统计运行时按清单拷快照并用 `python -I` 执行,缺了
  它就是一个起不来的快照;同处加断言守住这层耦合。
- 4 处默认编码文件 IO 显式 `encoding="utf-8"`(`claude_event_stream.py` 两处、
  `cursor_native_install.py`、`telemetry_hosts/cursor.py`)。其余 `open()` 逐个核过:
  是 `a+b`/`rb` 锁文件或只写 ASCII `"0"`,没有码页风险。
- 更新场景建桩用默认编码读 `.codex-plugin/plugin.json`(实测含 111 个非 ASCII 字节),
  Windows 上 cp1252 解码失败即 `plugin update step failed: update-default`;建桩改为显式
  utf-8。步骤失败信息同时带上底层原因——此前真实原因只落在私有 authorization 文件里。
- `SessionContextTest` 两处断言改回真实形态:`hosts/claude-code/hook_entry.py` 硬编码
  `command_shell="bash"`,命令体路径走 `as_posix()`,只有追加的说明句是原生路径。上一次
  按 JSON 转义比对是错方向。POSIX 下两种写法取值相同,不改变 macOS/Linux 的判定。

本地 `python scripts/run_tests.py` 949 tests OK(skipped=12),`codex_skill_projection.py
--check` PASS。
POSIX C locale 下文件系统编码是 ascii+surrogateescape,含 CJK 的路径经 argv
进来就是一串代理项;守卫里的 errors="strict" 在重新编码时直接抛
UnicodeEncodeError,把守卫本身要保护的 JSON 契约又炸回 traceback。
CI 证据(ubuntu-latest 3.10/3.12 LegacyCodePageCliTest):
  UnicodeEncodeError: 'utf-8' codec can't encode characters in position
  148-153: surrogates not allowed
改成 errors="surrogateescape" 后代理项编码回原始字节,调用方读到的正是它传入的路径。
CI 证据(windows-latest 3.10/3.12):
  KeyError: 'additional_context'
  AssertionError: 2 != 0   (Path.resolve 调用数)
telemetry_hosts/cursor.py 要求 Path(root).is_absolute(),Windows 上不带盘符的
/synthetic/... 判定为 False,身份绑定直接返回 None,7 个用例因此拿不到上下文。
真实宿主在 Windows 发送的是盘符限定的根目录,所以产品行为正确,是 fixture 不跨平台。
新增 native_root() 助手按平台补齐盘符;副作用是
test_missing_conflicting_and_invalid_identity_allow_without_guessing
此前在 Windows 上因所有 case 都缺盘符而空过,现在才校验自己声明的拒绝理由。
CI 证据(windows-latest 3.10/3.12,Platform suite 首次执行):
  3 failed: test_native_cursor_hook_to_local_outbox_to_platform_dashboard
  FileNotFoundError: [WinError 2] The system cannot find the file specified
内层脚本要真 git 和 Cursor 原生 hook 命令 sh …hook_bootstrap.sh,而它的 PATH 被洗成
python 目录 + os.defpath。POSIX 的 defpath 含 /bin:/usr/bin 两者都在,Windows 的
defpath 只有 system32,既没有 git 也没有 sh,于是在第一步 CreateProcess 就炸。
按 scripts/tests/test_windows_runtime.py 既有约定:从作业 PATH 解析 git/sh 目录并
加入受控 PATH,解析不到则 skip;CURSOR_PLUGIN_ROOT 改用 as_posix(),与同一约定里
传给 sh 的插件根目录形式一致。
CI 证据(windows-latest 3.10/3.12,WinError 2 之后的下一层):
  Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers
  encodings/cp1252.py line 23, in decode → 'NoneType' object has no attribute 'strip'
受控环境没有 SystemRoot/COMSPEC/PATHEXT,Windows 上的子 python.exe 在哈希随机化初始化
阶段就中止,这是 scripts/tests/env_sandbox.py 已记录的同一条事实,本 fixture 此前没跟上。
内层脚本以 python -I 运行,-I 忽略 PYTHONIOENCODING,因此 text=True 退回 locale cp1252
去解宿主 CLI 的 UTF-8 JSON 输出,读线程崩溃后 stdout 变成 None。
两处都改为显式:环境带上启动变量,subprocess 明确 encoding="utf-8"。
zhangdelong added 2 commits November 25, 2026 14:19
本分支最近 10 次 run 里 test_anchor_to_new_lock_transition_keeps_original_deadline
在 macos-latest 3.10 失败 4 次,全是同一条断言 assertEqual(2, len(deadlines)) 拿到 1。
原因是读线程 hook 预算只有 begin+0.16s,而主线程要等被调度才会创建新 lock 文件并释放
anchor;runner 满载时先到期就走了 else: yield,第二次 _acquire_read_lock 根本不发生。
本机单独 40 次 + 8 路 busy-loop 加压 30 次复现不了,只在 CI 全量套件下红。
改为把转换放进第一次尝试内部:记录 deadline 后先发布并独占新 lock 文件,再放开 anchor,
于是复用同一 deadline 的第二次等待必然出现,用例只受线程启动开销影响。
预算与上界由同一个 budget 推导并留调度余量。两条变异(递归换新 deadline → 1 != 2;
递归丢掉 deadline → 阻塞触发 join 超时)都仍然失败,属性未被弱化。生产代码未改动。
入口文档此前只列 Codex / Claude Code / Cursor / OpenCode,Qoder 只在 installation.md 出现,
读者无法从用户指南与跨平台矩阵得知它的安装形态和能力边界。补充内容只覆盖已实测事实:App
本地 ZIP 安装、版本目录整体替换、公共入口是 helix:<command> Skill、/helix:update 返回阻断、
本宿主未接入统计上报。

Cursor 在 Windows 上没有留下任何实机会话证据:POSIX sh 启动器只在 CI 里靠 Git for Windows
的 PATH 满足,注入 prompt 的身份变量前缀也只有 POSIX 引号形式。这里把它写进 host.json 的
limitations 与 Cursor 支持报告,而不是改成 PowerShell 语法——目标宿主的终端 shell 未经实测,
改写法只能靠猜。
@zhangdelong-didi zhangdelong-didi changed the title Feature support cursor open code qorder feat(hosts): 接入 Qoder,整合 Cursor/openCode,打通原生 Windows 门禁 Nov 25, 2026
@zhangdelong-didi

Copy link
Copy Markdown
Collaborator Author

CI 收敛 / matrix converged — 09b7950

四个运行全部 completed/success(45630926767、45627694452、45627448059 为 pull_request,45627438646 为 push)。逐作业实测摘要:

Runner Python Plugin suite Platform suite
ubuntu-latest 3.10 Ran 949 tests in 132.002s → OK (skipped=12) 840 passed, 2 skipped in 35.10s
ubuntu-latest 3.12 Ran 949 tests in 220.756s → OK (skipped=12) 840 passed, 2 skipped in 54.12s
macos-latest 3.10 Ran 949 tests in 329.702s → OK (skipped=12) 840 passed, 2 skipped in 130.93s
macos-latest 3.12 Ran 949 tests in 240.206s → OK (skipped=12) 840 passed, 2 skipped in 88.99s
windows-latest 3.10 Ran 949 tests in 641.832s → OK (skipped=124) 834 passed, 8 skipped in 486.17s
windows-latest 3.12 Ran 949 tests in 730.131s → OK (skipped=124) 834 passed, 8 skipped in 612.15s

Windows 线的收敛轨迹:197 failed / 57 errors → 35F/6E → 11F/6E → 7 → 0。

这轮绿不等于平台等价。 Windows 比 POSIX 多跳过 112 项,且平台侧少 6 个通过用例(834 vs 840、8 vs 2 skip)。仓库内静态的 POSIX 专属跳过声明只有 17 处,其余由 skipTest 在运行时判定,来源集中在三类:POSIX shell 依赖(含 Git for Windows POSIX shell is required for Claude hooks、argv fidelity is only proved through a real shell、this case runs the emitted sh preflight line under a sandbox)、真实目录权限(real directory permissions require an unprivileged process)、可选工具链缺失(uv is not installed / node is not available / Java compiler is required...)。CI 日志未逐项标注归属,所以这里只给计数,不宣称已定位每一项落在哪一类。

能力声明不因此上调:hosts/qoder/host.json 的 Windows 启动器限制与 hosts/cursor/host.json 新增的第 8 条 limitation 保持不变——本轮通过的是原生 Windows runner 上的 Python 套件与 Host Kit 契约测试,Qoder App 和 Cursor 在 Windows 上仍没有实机会话。

zhangdelong added 2 commits November 26, 2026 11:35
- 打包由 rglob 排除表改为正向白名单,拒绝未跟踪文件与越过插件根的符号链接
- hook 合并仅认领无额外参数的自生成命令,团队 handler 原样保留并告警
- 阶段遥测 evidence 补 schema,平台快照保留「未采集」语义
@zhangdelong-didi

Copy link
Copy Markdown
Collaborator Author

评审阻断项修复 CI / blockers 1–3 — 92c492c

push run 45750056854 与 PR run 45750063984(同一提交 92c492c)六个作业全部 completed/success。逐作业实测:

Runner Python Plugin suite Platform suite
ubuntu-latest 3.10 Ran 954 tests in 160.032s → OK (skipped=12) 841 passed, 2 skipped in 47.56s
ubuntu-latest 3.12 Ran 954 tests in 145.347s → OK (skipped=12) 841 passed, 2 skipped in 42.67s
macos-latest 3.10 Ran 954 tests in 356.647s → OK (skipped=12) 841 passed, 2 skipped in 119.98s
macos-latest 3.12 Ran 954 tests in 396.036s → OK (skipped=12) 841 passed, 2 skipped in 120.39s
windows-latest 3.10 Ran 954 tests in 510.841s → OK (skipped=124) 835 passed, 8 skipped in 548.13s
windows-latest 3.12 Ran 954 tests in 657.035s → OK (skipped=124) 835 passed, 8 skipped in 464.60s

本轮修复对应的覆盖:

  • 打包白名单:实际构建 345 项全部属于 Qoder 表面;新增白名单、逃逸符号链接、未跟踪文件、无 git 回退四个回归测试,POSIX 与 Windows 均跑通。
  • Hook 保留:新增团队参数用例(--team-profile strict 原样保留 + 告警 + 规范 handler 补齐);旧的版本目录折叠用例仍断言折叠为 2 个 handler。
  • 阶段遥测:插件侧断言 evidence.schema;平台侧新增 test_stage_facts_only_evidence_keeps_unavailable_semantics;跨模块实测采集结果被 validate_stage_supplement 接受、store 返回 accepted,unavailable 语义保留。

边界未变: Windows 仍比 POSIX 多跳过 112 项(skipped=124 vs 12),平台侧少 6 个通过(835 vs 841、8 vs 2 skip)。结论仍是「原生 Windows runner 上套件通过」,不等于平台等价;Qoder App 与 Cursor 在 Windows 上仍无实机会话。

第 4 项(已安装 1.0.0 用户发现不了更新)不是代码缺陷:reference/version-policy.json、各宿主清单、marketplace 条目与 tag 需要一起发布新版本,属于发布流程;本轮未伪造版本或改动发布元数据。

zhangdelong and others added 5 commits November 26, 2026 14:37
platform-support 说明带额外参数的 linter handler 不会被认领,而是原样保留并告警;
installation 按打包白名单补全 hosts/qoder、hosts/shared、宿主编排 schema 与根目录文件。
同版本覆盖不可靠,升级版本可确保验收加载新缓存目录。
自动巡检复用共享 Python 运行时,校验显式解释器并保留成功编辑。
阶段统计保留未采集状态、未知值和独立实测零值,补齐 AI 明细与每日统计消费。
升级物化缓存身份以刷新历史质量投影,保留每日历史及不可变账本。

补齐 schema、巡检、未知值、旧库升级和跨宿主流水线回归。
验证:macOS 插件 947 通过/13 跳过,平台 870 通过/2 跳过;OpenCode 151 通过,typecheck/Ruff 通过。
OpenCode 2.3.2 真实模型正负例通过;Windows 原生仍需远端 CI 验证。
正式版本入口、marketplace、版本策略与文档统一为 1.1.0,
Qoder 分发清单跟随主版本,不再维护独立版本号。
Windows 推送流水线长期存在两个随机红灯:test_plugin_hooks 在 60 秒后
超时,test_multiple_workspaces_do_not_reset_shared_budget 偶发调用数达到 5。
前者源于运行前检查用同步 & 探测候选解释器,损坏的别名或等待输入的命令
可以让整个钩子无限挂起;后者把共享截止时间错误地固定成调用次数少于 5。

- 解释器探测改为捕获进程:关闭探测 stdin,避免消费钩子载荷;单次探测
  与一次查找的总预算均有上限,超时终止并用有界读取排空输出。
- 每次查找重置探测预算,保证 install-python 在 winget 安装后仍能复检。
- 游标预算用例改为断言不会遍历全部 workspace,同时保留截止时间一致
  与总耗时上限,不再依赖 runner 的定时器粒度。
- 新增 Windows 原生回归:挂起的显式解释器必须在预算内返回 unusable。

验证:macOS 插件套件 962 通过/16 跳过;Windows 原生行为待远端 lane 验证。
@ayochao
ayochao merged commit 70d9002 into main Nov 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants